package compiler;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;


public class Libraries {
	private static ArrayList<String> actionLibrary = null;
	private static ArrayList<String> genericTypeLibrary = null;
	private static final File actionsFile=new File("actionsFile");
	private static final File genericsFile=new File("genericsFile");
	
	private static void loadLibrary(File file, ArrayList<String> library)
	{
		BufferedReader reader = null;
		System.out.println(file.getAbsolutePath());
		try {
		   reader=new BufferedReader(new FileReader(file.getAbsolutePath()+".txt"));
		   String read=new String();
		   while((read =reader.readLine()) != null)
			{
				library.add(read);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}				
	}

	public static ArrayList<String> getActionLibrary() {
		return actionLibrary;
	}

	public static ArrayList<String> getGenericTypeLibrary() {
		return genericTypeLibrary;
	}
	
	private static void createAll()
	{
		 actionLibrary = new  ArrayList<String> ();
		 genericTypeLibrary = new  ArrayList<String> ();
	}
	public static void loadAll()
	{
		createAll();
		loadLibrary(actionsFile,getActionLibrary());
		loadLibrary(genericsFile,getGenericTypeLibrary());
	}	
		
}
